package com.GlobalPaint.app.ui.HTML;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.ImageView;
import android.widget.TextView;

import com.GlobalPaint.app.R;
import com.GlobalPaint.app.bean.PaletteDetailsBean;
import com.GlobalPaint.app.utils.DataManager;

import java.util.List;

public class textActivity extends AppCompatActivity implements View.OnClickListener{
    private PaletteDetailsBean.DataBean Bean;
    private List<PaletteDetailsBean.DataBean> list;
    private WebView wv_talent;
    private ImageView iv_goback;
    private TextView tv_common_center;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_talent_html);
        initView();

    }

    private void initView() {
        iv_goback = (ImageView) findViewById(R.id.iv_goback);
        iv_goback.setOnClickListener(this);
        tv_common_center = (TextView) findViewById(R.id.tv_common_center);
        tv_common_center.setText("详情");
        wv_talent = (WebView) findViewById(R.id.wv_talent);
        wv_talent.loadDataWithBaseURL(null,"","text/html","utf-8", null);//清空webview
        if( DataManager.typename.equals("文章1")){
            list = (List<PaletteDetailsBean.DataBean>) getIntent().getSerializableExtra("serinfo");
            String contentString=list.get(getIntent().getIntExtra("id",0)).getFValue(); //获取文章
            wv_talent.loadDataWithBaseURL(null,contentString,"text/html","utf-8", null);
            WebSettings settings=wv_talent.getSettings();
            settings.setTextSize(WebSettings.TextSize.LARGER);
        }else {
            Bean= (PaletteDetailsBean.DataBean) getIntent().getSerializableExtra("serinfo");
            String contentString=Bean.getFValue(); //获取文章
            wv_talent.loadDataWithBaseURL(null,contentString,"text/html","utf-8", null);
            WebSettings settings=wv_talent.getSettings();
            settings.setTextSize(WebSettings.TextSize.LARGER);
        }


    }
    @Override
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.iv_goback:
                finish();
                break;
        }
    }
}
